/*
 * Copyright (c) 2018-2999 深圳市阿毛科技有限公司 All rights reserved.
 *
 * https://www.lamyz.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.lam.mall.api.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lam.common.base.domain.Result;
import com.lam.common.constant.CommonConstant;
import com.lam.framework.operLog.annotation.Log;
import com.lam.mall.app.vo.SkuVo;
import com.lam.mall.entity.ProdSku;
import com.lam.mall.param.ProdSkuParam;
import com.lam.mall.service.ProdSkuService;

import cn.hutool.core.bean.BeanUtil;

/**
 * @author lam
 */
@RestController
@RequestMapping("/${frontPath}/sku")
@Log(title = "sku规格接口")
public class SkuApiController {

	@Autowired
    private ProdSkuService prodSkuService;

    

    @GetMapping("/getSkuList")
    @Log(oper = "通过prodId获取商品全部规格列表")
    public Result getSkuListByProdId(String prodId) {
    	
        ProdSkuParam param = new ProdSkuParam();
        param.setProdId(prodId);
        param.setStatus(CommonConstant.STATUS_NORMAL_1);
        param.setDelStatus(CommonConstant.DEL_STATUS_NORMAL);
		List<ProdSku> skus = prodSkuService.selectList(param );
        List<SkuVo> skuVoList = BeanUtil.copyToList(skus, SkuVo.class);
        return Result.ok(skuVoList);
    }
}
